package edu.bbu.commonproject.desktop.client.services.thrift.files;

import java.io.Serializable;

/**
 * The file object sent on socket.
 */
public class SocketFile implements Serializable
{
	/** The serial version ID for serialization. */
	private static final long serialVersionUID = 2684593243420806977L;
	
	/** The socket file type for upload. */
	public static final int FILE_UPLOAD = 1;
	
	/** The socket file type for download. */
	public static final int FILE_DOWNLOAD = 2;
	
	/** The socket file type. */
	private int action;
	
	/** The owner of the file. */
	private String owner;
	
	/** The name of the file. */
	private String fileName;
	
	/** The directory name where the file is placed or will be placed. */
	private String directoryName;
	
	/** The file version. */
	private int fileVersion;
	
	/**
	 * The constructor with single parameter.
	 * @param actionType the file type (FILE_UPLOAD or FILE_DOWNLOAD).
	 */
	public SocketFile(int actionType)
	{
		this.action = actionType;
		this.owner = "";
		this.fileName = "";
		this.directoryName = "";
		this.fileVersion = 0;
	}
	
	/**
	 * The constructor with multiple parametrs.
	 * @param actionType actionType the file type (FILE_UPLOAD or FILE_DOWNLOAD).
	 * @param owner the owner of the file.
	 * @param fileNama the name of the file.
	 * @param directoryName the name of directory where the file is palced/will be placed.
	 */
	public SocketFile(int actionType, String owner, String fileNama, String directoryName)
	{
		this.action = actionType;
		this.owner = owner;
		this.fileName = fileNama;
		this.directoryName = directoryName;
	}

	/**
	 * Setting the file type.
	 * @param action the file type.
	 */
	public void setAction(int action)
	{
		this.action = action;
	}
	
	/**
	 * Getting the file type.
	 * @return the file type.
	 */
	public int getAction()
	{
		return action;
	}
	
	/**
	 * Setting the owner.
	 * @param owner the owner of the file.
	 */
	public void setOwner(String owner)
	{
		this.owner = owner;
	}
	
	/**
	 * Getting the owner.
	 * @return the owner of the file.
	 */
	public String getOwner()
	{
		return owner;
	}
	
	/**
	 * Setting the file name.
	 * @param fileName the name of the file.
	 */
	public void setFileName(String fileName)
	{
		this.fileName = fileName;
	}
	
	/**
	 * Getting the file name.
	 * @return the file name.
	 */
	public String getFileName()
	{
		return fileName;
	}
	
	/**
	 * Setting the directory name.
	 * @param directoryName the name of directory.
	 */
	public void setDirectoryName(String directoryName)
	{
		this.directoryName = directoryName;
	}
	
	/**
	 * Getting the directory name.
	 * @return the name fo directory.
	 */
	public String getDirectoryName()
	{
		return directoryName;
	}
	
	/**
	 * Getting the file version.
	 * @return the file version.
	 */
	public int getFileVersion()
	{
		return fileVersion;
	}
	
	/**
	 * Setting the file version.
	 * @param fileVersion the file version.
	 */
	public void setFileVersion(int fileVersion)
	{
		this.fileVersion = fileVersion;
	}
}
